/* AI 聊天容器 */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
    overflow: hidden;
}

/* 导航栏样式 */
.navbar {
    background: #fff;
    border-bottom: 1px solid #eee;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

/* 消息容器 */
.messageContainer {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.messageList {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息项 */
.messageItem {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeIn 0.3s ease-in-out;
}

.messageItem.user {
    flex-direction: row-reverse;
}

/* 头像 */
.messageAvatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user .messageAvatar {
    background: #007AFF;
}

.ai .messageAvatar {
    background: #722ed1;
}

/* 消息内容 */
.messageContent {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user .messageContent {
    align-items: flex-end;
}

.ai .messageContent {
    align-items: flex-start;
}

/* 消息气泡 */
.messageBubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user .messageBubble {
    background: #007AFF;
    color: white;
    border-bottom-right-radius: 6px;
}

.ai .messageBubble {
    background: white;
    color: #333;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 6px;
}

/* 消息时间 */
.messageTime {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* 输入区域 */
.inputArea {
    background: white;
    border-top: 1px solid #eee;
    padding: 16px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.inputWrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 100%;
}

.messageInput {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    border-radius: 20px;
    border: 1px solid #ddd;
    padding: 10px 16px;
    font-size: 14px;
    background: #f9f9f9;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
}

.messageInput:focus {
    border-color: #007AFF;
    background: white;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.sendButton {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #007AFF;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sendButton:hover:not(:disabled) {
    background: #0056b3;
    transform: scale(1.05);
}

.sendButton:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 打字指示器 */
.typingIndicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typingIndicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.typingIndicator span:nth-child(1) {
    animation-delay: 0s;
}

.typingIndicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typingIndicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .messageList {
        padding: 16px 12px;
    }

    .messageContent {
        max-width: 85%;
    }

    .messageBubble {
        padding: 10px 14px;
        font-size: 14px;
    }

    .inputArea {
        padding: 12px;
    }

    .messageAvatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* 滚动条样式 */
.messageList::-webkit-scrollbar {
    width: 4px;
}

.messageList::-webkit-scrollbar-track {
    background: transparent;
}

.messageList::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.messageList::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 适配暗色模式 */
@media (prefers-color-scheme: dark) {
    .container {
        background: #1a1a1a;
    }

    .navbar {
        background: #2d2d2d;
        border-bottom-color: #404040;
    }

    .ai .messageBubble {
        background: #2d2d2d;
        color: #e5e5e5;
        border-color: #404040;
    }

    .inputArea {
        background: #2d2d2d;
        border-top-color: #404040;
    }

    .messageInput {
        background: #1a1a1a;
        color: #e5e5e5;
        border-color: #404040;
    }

    .messageInput:focus {
        background: #2d2d2d;
        border-color: #007AFF;
    }
}